#include "pool.h"
#include <iostream>
#include <unistd.h>
#include <memory>
#include <vector>

using namespace std;

class A {
public:
    void start()
    {

        vector<int> aa = {1,2,3,4,5,6,7,8,9,10,11};
        int i  =0;
        thisthread.addThread(5);
        while((i) < 10)
        {
            //cout << i << "sadas" << endl;
            thisthread.addTask([&, aa, i](){
                    tst( aa[i]);
            });
            i++;
        }
#if 0
        while(thisthread.isbusy())
        {
            sleep(1);
        }
#endif
    cout << "byebye";
    }
private:
    int a = 56;
    mutex mlock;
private:
    bool tst2()
    {
        cout << a << endl;
    }

     bool tst(int tt){
        //tst2();

            cout << tt << endl;
            sleep(1);

    }
        threadpool thisthread;

};

int main()
{
    A a;
    cout << 45 << endl;
    a.start();

    sleep(10);


    return 0;
}
